  <?php if(!empty($id)) { ?>
 <form action="<?= $admin_base_url; ?>section/edit/<?=$id;?>/<?php echo $cur_page;?>" method="post" id="section_form">
 <?php } else { ?>
 <form action="<?= $admin_base_url; ?>section/add/<?= $cur_page;?>" method="post" id="section_form">
 <?php } ?>
 <br/>

        <label>Course</label><select name='course_id' class="txt1">
        								<option> Select </option>
        								<?php
		                                foreach($query as $row)
										{
											echo "<option";
											if($row['id'] == $section['course_id']) 
											{ 
											echo " selected='selected' "; }
											echo  " value=".$row['id']."> ".$row['name']." </option>";
										}
		                                 ?> </select> <br/>
		<label> section Name </label>
        
		<input class="txt1" type="text" name="section" value="<?php echo $section['section'];?>" />
	
		&nbsp;
		
			<div class="buttons">
			    <button type="submit" name="save" class="positive" value="save" >
			        <img src="<?php echo $admin_image_path?>icons/apply.png" alt=""/>
			          <?php if(!empty($id)) { ?>
 							Update section
 							<input type="hidden" name="id" value="<?php echo $id;?>" />
 							<input type="hidden" name="rurl" value="<?php echo $rurl;?>" />
 					  <?php } else { ?>
 					  	Add section
 					  	<?php } ?>

 			    </button>
			   <a href="<?= $admin_base_url; ?>section/cancel?rurl=<?php echo $rurl;?>" class="negative">
			        <img src="<?php echo $admin_image_path?>icons/cross.png" alt=""/>
			        Cancel
			   </a>
			</div>
		
	


 </form>
 <script>
 $(document).ready(function() {
     $("#section_form").RSV({
       onCompleteHandler: frmSubmit,
       errorFieldClass: "errorDesc",
       displayType: "display-html",
       errorHTMLItemBullet: "&#8212; ",
             rules: [
                     "required,section,Please enter name."
             ]
     });
  // a custom onComplete handler to prevent form submits for the demo
     function frmSubmit()
     {
       return true;
     }

        
});
 </script>